<script type="text/html" template lay-done="layui.data.sendParams(d);">
    <div class="layui-form coreshop-form layui-form-pane" lay-filter="LAY-app-coreshopordermeeting-editForm" id="LAY-app-coreshopordermeeting-editForm">
        <div class="layui-tab layui-tab-card" style="margin: 0 0 10px 0">
            <ul class="layui-tab-title">
                <li class="layui-this">基础信息</li>
                <li>商品管理</li>
                <li>用户</li>
                <li>邀请码</li>
            </ul>
            <div class="layui-tab-content" style="min-height: 500px;">
                <!-- 基础信息tab -->
                <div class="layui-tab-item layui-show">
                    <div class="layui-form-item layui-hide">
                        <label for="id" class="layui-form-label  layui-form-required">编号</label>
                        <div class="layui-input-block">
                            <input type="number" min="0" max="999999" name="id" lay-verType="tips" lay-verify="required|number" class="layui-input" value="{{d.params.data.id || '' }}" placeholder="请输入编号" lay-reqText="请输入编号并为数字" />
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label for="name" class="layui-form-label  layui-form-required">订货会名称</label>
                        <div class="layui-input-block">
                            <input name="name" lay-verType="tips" lay-verify="required" class="layui-input" placeholder="请输入订货会名称" lay-reqText="请输入订货会名称" value="{{d.params.data.name || '' }}" />
                        </div>
                    </div>

                    <div class="layui-form-item layui-form-text">
                        <label for="brief" class="layui-form-label layui-form-required">描述</label>
                        <div class="layui-input-block">
                            <textarea name="describe" id="describe" lay-verify="required" class="layui-textarea" lay-reqText="描述内容" placeholder="描述内容">{{d.params.data.describe }}</textarea>
                        </div>
                    </div>


                    <div class="layui-form-item">
                        <label for="startdatetime" class="layui-form-label  layui-form-required">开始时间</label>
                        <div class="layui-input-block">
                            <input name="startdatetime" id="editTime-coreshopordermeeting-startdatetime" type="text" lay-verType="tips" lay-verify="required|datetime" class="layui-input" placeholder="请输入开始时间" lay-reqText="请输入开始时间" value="{{d.params.data.startdatetime || '' }}" />
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label for="enddatetime" class="layui-form-label  layui-form-required">结束时间</label>
                        <div class="layui-input-block">
                            <input name="enddatetime" id="editTime-coreshopordermeeting-enddatetime" type="text" lay-verType="tips" lay-verify="required|datetime" class="layui-input" placeholder="请输入结束时间" lay-reqText="请输入结束时间" value="{{d.params.data.enddatetime || '' }}" />
                        </div>
                    </div>

                    <div class="layui-form-item">
                        <!--<fieldset class="layui-elem-field layui-field-title site-title"><legend><a name="compress">封面图</a></legend></fieldset>-->
                        <div class="layui-form-item">
                            <label class="layui-form-label  layui-form-required" for="avatarImage">封面图：</label>
                            <div class="layui-input-inline layui-inline-10">
                                <input name="image" id="fengmianImage" size="15" lay-verify="required" autocomplete="off" class="layui-input" lay-reqText="请输入【缩略图】"
                                       value="{{d.params.data.image || '' }}" />
                            </div>
                            <div class="layui-input-inline">
                                <div class="layui-upload">
                                    <button type="button" class="layui-btn" id="upBtn">上传图片</button>
                                    <div class="layui-upload-list">
                                        <img class="layui-upload-img" id="viewImgBox" src="{{ d.params.data.image }}">
                                        <p id="viewTextBox"></p>
                                    </div>
                                </div>
                            </div>
                        </div>

                        <!--<fieldset class="layui-elem-field layui-field-title site-title"><legend><a name="compress">图集</a></legend></fieldset>-->
                        <div class="layui-form-item">
                            <div class="layui-input-inline layui-inline-2">

                                <input type="hidden" name="images" id="imageIds" class="layui-input" placeholder="请上传缩略图" lay-reqText="请上传缩略图" />
                                <button type="button" class="layui-btn  layui-btn-sm" id="upBtnimageIds"><i class="layui-icon"></i>上传图片</button>
                            </div>
                            <div class="layui-form-mid">
                                图集：[建议数量控制在10张以内]：
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <blockquote class="layui-elem-quote layui-quote-nm" style="margin-top: 10px;">
                                <div class="layui-upload-list" id="upload-more-list"></div>
                            </blockquote>
                        </div>

                        <!--<fieldset class="layui-elem-field layui-field-title site-title"><legend><a name="compress">媒体</a></legend></fieldset>
                        <div class="layui-form-item">
                            <label class="layui-form-label" for="video">视频：</label>
                            <div class="layui-input-inline layui-inline-10">
                                <input name="goods[video]" size="15" autocomplete="off" class="layui-input" lay-reqText="请输入【视频地址】" />
                            </div>
                            <div class="layui-form-mid">支持常用视频播放格式。</div>
                        </div>-->
                    </div>

                </div>
                <!-- 产品tab -->
                <div class="layui-tab-item">
                    <div id="LAY-app-CoreCmsGoods-toolbar">
                        <div class="layui-form coreshop-toolbar-search-form">
                            <div class="layui-form-item">
                                <div class="layui-inline">
                                    <div class="layui-input-inline">
                                        <input type="text" name="searchgoodsbn" id="searchgoodsbn" placeholder="请输入商品编码" class="layui-input">
                                    </div>
                                </div>

                                <div class="layui-inline">

                                    <div class="layui-inline">
                                        <button class="layui-btn layui-btn-sm" lay-submit lay-filter="LAY-app-CoreCmsGoods-search"><i class="layui-icon layui-icon-search"></i>查找并添加</button>
                                    </div>
                                </div>
                            </div>
                        </div>

                        <table id="demo" lay-filter="test">
                        </table>
                    </div>
                </div>
                <!-- 用户tab -->
                <div class="layui-tab-item">
                    <div id="LAY-app-CoreCmsGoodsUser-toolbar">
                        <div class="layui-form coreshop-toolbar-search-form">
                            <div class="layui-form-item">
                                <div class="layui-inline">
                                    <div class="layui-input-inline">
                                        <input type="text" name="searchuserphone" id="searchuserphone" placeholder="请输入手机号码" class="layui-input">
                                    </div>
                                </div>

                                <div class="layui-inline">

                                    <div class="layui-inline">
                                        <button class="layui-btn layui-btn-sm" lay-submit lay-filter="LAY-app-CoreCmsGoodsUser-search"><i class="layui-icon layui-icon-search"></i>查找并添加</button>
                                    </div>
                                </div>
                            </div>
                        </div>

                        <table id="tableuser" lay-filter="tableuserevent">
                        </table>
                    </div>
                </div>
                <!-- 邀请码tab -->
                <div class="layui-tab-item">
                     
                    <div id="LAY-app-InvitationCode-toolbar">
                        <div class="layui-form coreshop-toolbar-search-form">
                            <div class="layui-form-item">
                                <div class="layui-inline">
                                    <div class="layui-input-inline">
                                        <input type="text" name="invitationcode" id="invitationcode" placeholder="输入自定义邀请码" class="layui-input">
                                    </div>
                                </div>

                                <div class="layui-inline">

                                    <div class="layui-inline">
                                        <button class="layui-btn layui-btn-sm" lay-submit lay-filter="LAY-app-InvitationCode-add"><i class="layui-icon layui-icon-search"></i>添加</button>
                                    </div>
                                </div>
                            </div>
                        </div>

                        <table id="tableinvitationcode" lay-filter="tableinvitationcodeevent">
                        </table>
                    </div>
                </div>
            </div>


            <div class="layui-form-item text-right core-hidden">
                <input type="button" class="layui-btn" lay-submit lay-filter="LAY-app-coreshopordermeeting-editForm-submit"
                       id="LAY-app-coreshopordermeeting-editForm-submit" value="确认编辑">
            </div>
        </div>
    </div>
</script>





<script id="image_tpl" type="text/html">
    {{# layui.each(d, function(index, item){  }}
    <div class="imgdiv">
        <img src="{{ item }}" class="layui-upload-img" onclick='layui.coreHelper.viewImage("{{ item }}")' style="width: 100px;height:100px;">
        <div id="operate">
            <div><a class="del" onclick="delImg(this,'{{ item }}')">删除</a>|<a class="setmain" onclick="setDefault(this,'{{ item }}')">设为主图</a></div>
        </div>
    </div>
    {{#  }); }}
</script>

<script type="text/html" id="LAY-app-MeetingGoods-tableBox-bar">
    <!--<a class="layui-btn layui-btn-primary layui-btn-xs" lay-event="detail">查看</a>
    <a class="layui-btn layui-btn-xs" lay-event="edit">编辑</a>-->
    <!--<a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除</a>-->
    <a lay-filter="LAY-app-CoreCmsGoods-remove" class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del" data-dropdown="#goodsTbDelDrop{{d.LAY_INDEX}}" no-shade="true">移除</a>
</script>

 
<script type="text/html" id="LAY-app-InvitationCode-tableBox-bar">
    <!--<a class="layui-btn layui-btn-primary layui-btn-xs" lay-event="detail">查看</a>
    <a class="layui-btn layui-btn-xs" lay-event="edit">编辑</a>-->
    <!--<a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除</a>-->
    <a lay-filter="LAY-app-InvitationCode-remove" class="layui-btn layui-btn-danger layui-btn-xs" 
       lay-event="del" data-dropdown="#goodsTbDelDrop{{d.LAY_INDEX}}" no-shade="true">删除</a>
</script>


<!--设置是否允许访问-->
<script type="text/html" id="switch_isAllow">
    <input type="checkbox" name="switch_isAllow" value="{{d.id}}" lay-skin="switch" lay-text="允许|禁止" lay-filter="switch_isAllow" {{ d.isAllow ? 'checked' : '' }}>
</script>

<script>
    var debug = layui.setter.debug;
    layui.data.sendParams = function (d) {
        //开启调试情况下获取接口赋值数据
        if (debug) { console.log(d.params.data); }
        layui.use(['admin', 'table', 'form', 'laydate', 'upload', 'coreHelper', 'cropperImg', 'transfer', "laytpl"],
            function () {
                var $ = layui.$
                    , form = layui.form
                    , table = layui.table
                    , admin = layui.admin
                    , laytpl = layui.laytpl
                    , laydate = layui.laydate
                    , upload = layui.upload
                    , cropperImg = layui.cropperImg
                    , transfer = layui.transfer
                    , coreHelper = layui.coreHelper;

                laydate.render({
                    elem: '#editTime-coreshopordermeeting-startdatetime',
                    type: 'datetime'
                });
                laydate.render({
                    elem: '#editTime-coreshopordermeeting-enddatetime',
                    type: 'datetime'
                });
                //数据绑定
                table.render({
                    elem: '#demo',
                    url: layui.setter.apiUrl + 'Api/CoreShopOrderMeetingGoods/GetPageList?meetingid=' + d.params.data.id,
                    method: 'POST',
                    pagebar: '#LAY-app-CoreCmsGoods-pagebar',
                    /*   toolbar: '#LAY-app-CoreCmsGoods-toolbar',*/
                    className: 'pagebarbox',
                    defaultToolbar: [],
                    height: 'full-179',//无面包屑127,搜索框189,1行62
                    page: true,
                    limit: 30,
                    limits: [10, 15, 20, 25, 30, 50, 100, 200],
                    text: { none: '暂无相关数据' },
                    cols: [
                        [
                            { type: "checkbox", fixed: "left" },
                            { field: 'goods.bn', title: '货号', width: 130, sort: false, templet: function (data) { return data.goods.bn } },
                            { width: 142, align: 'center', title: '操作', toolbar: '#LAY-app-MeetingGoods-tableBox-bar' },

                            {
                                field: 'goods.images', title: '封面图', width: 60, sort: false,
                                templet: function (d) {

                                    if (d.goods.image) {
                                        return '<a href="javascript:void(0);" onclick=layui.coreHelper.viewImage("' + d.goods.image + '")><image style="max-width:30px;max-height:30px;" src="' + d.goods.image + '" /></a>';
                                    }
                                    else {
                                    //  return '<a href="javascript:void(0);" onclick=layui.coreHelper.viewImage("' + setter.noImagePicUrl + '")><image style="max-width:30px;max-height:30px;" src="' + setter.noImagePicUrl + '" /></a>';
                                        return '<a>-</a>';
                                    }
                                }
                            },
                            //, editTrigger = 'click'
                            { field: 'meetingprice', title: '订货会价格', sort: false, width: 80, edit: "text" },
                            { field: 'meetingminimum', title: '起订量', sort: false, width: 80, edit: "text" },

                            { field: 'goods.price', title: '销售价', sort: false, width: 70, templet: function (data) { return '￥' + data.goods.price } },
                            { field: 'goods.name', title: '商品名称', sort: false, templet: function (data) { return data.goods.name } },




                            //{ field: 'costprice', title: '成本价', sort: false, width: 70, templet: function (data) { return '￥' + data.costprice } },
                            //{ field: 'mktprice', title: '市场价', sort: false, width: 70, templet: function (data) { return '￥' + data.mktprice } },
                            //{
                            //    field: 'goodsCategoryId', title: '分类', sort: false, width: 80, templet: function (data) {
                            //        for (var i = 0; i < d.data.categoriesAll.length; i++) {
                            //            if (d.data.categoriesAll[i].id === data.goodsCategoryId) {
                            //                return d.data.categoriesAll[i].name;
                            //            }
                            //        }
                            //        return "";
                            //    }
                            //},
                            //{
                            //    field: 'brandId', title: '品牌', sort: false, width: 80, templet: function (data) {
                            //        for (var i = 0; i < d.data.brands.length; i++) {
                            //            if (d.data.brands[i].id === data.brandId) {
                            //                return d.data.brands[i].name;
                            //            }
                            //        }
                            //        return "";
                            //    }
                            //},
                            //{ field: 'updateTime', title: '更新时间', sort: false, width: 130 },

                        ]
                    ]
                    //,parseData: function (res) { //res 即为原始返回的数据
                    //    return {
                    //        "code": res.status, //解析接口状态
                    //        "msg": res.message, //解析提示文本
                    //        "count": res.total, //解析数据长度
                    //        "data": res.data.item //解析数据列表
                    //    };
                });
                //数据绑定-用户
                table.render({
                    elem: '#tableuser',
                    url: layui.setter.apiUrl + 'Api/CoreShopOrderMeetingUser/GetPageList?meetingid=' + d.params.data.id,
                    method: 'POST',
                    //pagebar: '#LAY-app-CoreCmsGoods-pagebar',
                    /*   toolbar: '#LAY-app-CoreCmsGoods-toolbar',*/
                    className: 'pagebarbox',
                    defaultToolbar: [],
                    height: 'full-179',//无面包屑127,搜索框189,1行62
                    page: true,
                    limit: 30,
                    limits: [10, 15, 20, 25, 30, 50, 100, 200],
                    text: { none: '暂无相关数据' },
                    cols: [
                        [
                            /*{ type: "checkbox", fixed: "left" },*/
                            //{ width: 142, align: 'center', title: '操作', toolbar: '#LAY-app-MeetingGoodsUser-tableBox-bar' },
                            { field: 'phone', title: '当前状态', width: 130, sort: false },
                            { field: 'isAllow', title: '访问', width: 80, templet: '#switch_isAllow', sort: false, unresize: true },

                            { field: 'phone', title: '用户手机号', width: 130, sort: false },
                            { field: 'addtime', title: '添加时间', width: 130, sort: false },
                            { field: 'fromType', title: '来源', width: 130, sort: false },




                        ]
                    ]

                });
                //数据绑定-邀请码
                table.render({
                    elem: '#tableinvitationcode',
                    url: layui.setter.apiUrl + 'Api/OrderMeetingInvitationCode/GetPageList?meetingid=' + d.params.data.id,
                    method: 'POST',
                    //pagebar: '#LAY-app-CoreCmsGoods-pagebar',
                    /*   toolbar: '#LAY-app-CoreCmsGoods-toolbar',*/
                    className: 'pagebarbox',
                    defaultToolbar: [],
                    height: 'full-179',//无面包屑127,搜索框189,1行62
                    page: true,
                    limit: 30,
                    limits: [10, 15, 20, 25, 30, 50, 100, 200],
                    text: { none: '暂无相关数据' },
                    cols: [
                        [
                            /*{ type: "checkbox", fixed: "left" },*/
                            { width: 142, align: 'center', title: '操作', toolbar: '#LAY-app-InvitationCode-tableBox-bar' },
                            { field: 'code', title: '邀请码', width: 130, sort: false },
                            { field: 'addtime', title: '添加时间', width: 130, sort: false },
                            { field: 'isUse', title: '使用状态', width: 130, sort: false, templet: function (data) { return data.isUse?"已使用":"可用"  } },
                            { field: 'usetime', title: '使用时间', width: 130, sort: false },
                        ]
                    ]

                });

                //监听工具条
                table.on('tool(test)',
                    function (obj) {
                        console.log("工具条监听", obj)
                        if (obj.event === 'detail') {
                            doDetails(obj);
                        } else if (obj.event === 'del') {
                            doMove(obj);
                        } else if (obj.event === 'edit') {
                            doEdit(obj)
                        }
                    });


              

                  //监听商品表格编辑
                table.on('edit(test)',
                    function (obj) { //注：edit是固定事件名，test是table原始容器的属性 lay-filter="对应的值"
                        console.log(obj.value); //得到修改后的值
                        console.log(obj.field); //当前编辑的字段名
                        console.log(obj.data); //所在行的所有相关数据
                        obj.data.goods = null
                        coreHelper.Post("Api/CoreShopOrderMeetingGoods/DoEdit", obj.data, function (e) {
                            if (debug) { console.log(e); } //开启调试返回数据
                            layer.msg(e.msg);
                            table.reloadData('demo');

                        });
                    });

                //执行单个移除
                function doMove(obj) {
                    coreHelper.Post("Api/CoreShopOrderMeetingGoods/DoDelete", { id: obj.data.id }, function (e) {
                        if (debug) { console.log(e); } //开启调试返回数据
                        layer.msg(e.msg);
                        table.reloadData('demo');

                    });
                }

                //商品监听搜索
                form.on('submit(LAY-app-CoreCmsGoods-search)',
                    function (data) {
                        console.log("serachword:", data.field.name)

                        coreHelper.Post("Api/CoreShopOrderMeetingGoods/DoCreate", { goodsbn: data.field.searchgoodsbn, meetingid: d.params.data.id }, function (e) {
                            if (debug) { console.log(e); } //开启调试返回数据
                            table.reloadData('demo');
                            layer.msg(e.msg);
                        });

                        //var tempfilter = $.extend({}, searchwhere, data.field);//合并tab筛选和普通搜索
                        ////执行重载
                        //table.reloadData('LAY-app-CoreCmsGoods-tableBox', {
                        //    where: tempfilter
                        //    , page: {
                        //        curr: 1 //重新从第 1 页开始
                        //    }
                        //});
                    });

                //初始化图片
                if (d.params.data.images) {
                    imgs = d.params.data.images.split(',');
                    defaultImg = imgs[0];
                    $('#imageIds').val(imgs);
                    var getTpl = image_tpl.innerHTML, viewBox = document.getElementById('upload-more-list');
                    laytpl(getTpl).render(imgs, function (html) {
                        viewBox.innerHTML = html;
                    });
                }
                //封面图图片上传
                $('#upBtn').click(function () {
                    cropperImg.cropImg({
                        aspectRatio: 1 / 1,
                        imgSrc: $('#viewImgBox').attr('src'),
                        onCrop: function (data) {
                            var loadIndex = layer.load(2);
                            coreHelper.Post("api/Tools/UploadFilesFByBase64", { base64: data }, function (res) {
                                if (0 === res.code) {
                                    $('#viewImgBox').attr('src', res.data.fileUrl);
                                    $("#fengmianImage").val(res.data.fileUrl);
                                    layer.msg(res.msg);
                                    layer.close(loadIndex);
                                } else {
                                    layer.close(loadIndex);
                                    layer.msg(res.msg, { icon: 2, anim: 6 });
                                }
                            });
                        }
                    });
                    form.render();
                });

                //图集上传
                $('#upBtnimageIds').click(function () {
                    cropperImg.cropImg({
                        aspectRatio: 1 / 1,
                        onCrop: function (data) {
                            var loadIndex = layer.load(2);
                            coreHelper.Post("api/Tools/UploadFilesFByBase64", { base64: data }, function (res) {
                                if (0 === res.code) {
                                    imgs.push(res.data.fileUrl);
                                    $('#imageIds').val(imgs);
                                    var getTpl = image_tpl.innerHTML, view = document.getElementById('upload-more-list');
                                    laytpl(getTpl).render(imgs, function (html) {
                                        view.innerHTML = html;
                                    });
                                    layer.msg(res.msg);
                                    layer.close(loadIndex);
                                } else {
                                    layer.close(loadIndex);
                                    layer.msg(res.msg, { icon: 2, anim: 6 });
                                }
                            });
                        }
                    });
                    form.render();
                });



                //监听人员开关
                layui.form.on('switch(switch_isAllow)', function (obj) {

                    if (debug) { console.log("editobj", { id: obj.value }); } 

                    coreHelper.Get("Api/CoreShopOrderMeetingUser/SetisAllow?id=" + obj.value,   function (e) {
                        if (debug) { console.log(e); } //开启调试返回数据
                        //table.reloadData('LAY-app-CoreCmsGoods-tableBox');
                        layer.msg(e.msg);
                    });
                });

                //监听人员搜索
                form.on('submit(LAY-app-CoreCmsGoodsUser-search)',
                    function (data) {
                        console.log("searchuserphone:", data.field.searchuserphone)

                        coreHelper.Post("Api/CoreShopOrderMeetingUser/DoCreate", { userphone: data.field.searchuserphone, meetingid: d.params.data.id }, function (e) {
                            if (debug) { console.log(e); } //开启调试返回数据
                            table.reloadData('tableuser');
                            layer.msg(e.msg);
                        });

                        //var tempfilter = $.extend({}, searchwhere, data.field);//合并tab筛选和普通搜索
                        ////执行重载
                        //table.reloadData('LAY-app-CoreCmsGoods-tableBox', {
                        //    where: tempfilter
                        //    , page: {
                        //        curr: 1 //重新从第 1 页开始
                        //    }
                        //});
                    });


                //监听邀请码添加
                form.on('submit(LAY-app-InvitationCode-add)',
                    function (data) {
                        console.log("invitationcode:", data.field.invitationcode)

                        coreHelper.Post("Api/OrderMeetingInvitationCode/DoCreate", { code: data.field.invitationcode, meetingid: d.params.data.id }, function (e) {
                            if (debug) { console.log(e); } //开启调试返回数据
                            table.reloadData('tableinvitationcode');
                            layer.msg(e.msg);
                        });

                        //var tempfilter = $.extend({}, searchwhere, data.field);//合并tab筛选和普通搜索
                        ////执行重载
                        //table.reloadData('LAY-app-CoreCmsGoods-tableBox', {
                        //    where: tempfilter
                        //    , page: {
                        //        curr: 1 //重新从第 1 页开始
                        //    }
                        //});
                    });

                    //监听邀请码烧出
                table.on('tool(tableinvitationcodeevent)',
                    function (obj) {
                       
                        if (obj.event === 'detail') {
                            doDetails(obj);
                        } else if (obj.event === 'del') {
                            coreHelper.Post("Api/OrderMeetingInvitationCode/DoDelete", { id: obj.data.id }, function (e) {
                                if (debug) { console.log(e); } //开启调试返回数据
                                table.reloadData('tableinvitationcode');
                                layer.msg(e.msg);
                            });
                        } else if (obj.event === 'edit') {
                            doEdit(obj)
                        }
                    });




                form.verify({

                });
                //重载form
                form.render(null, 'LAY-app-coreshopordermeeting-editForm');
            })
    };

    //删除图片
    function delImg(obj, imageUrl) {
        var imgDiv = $(obj).parent().parent().parent();
        imgDiv.remove();
        var index = imgs.indexOf(imageUrl);
        if (index > -1) {
            imgs.splice(index, 1);
        }
        $('#imageIds').val(imgs);
    }
    //设为默认图
    function setDefault(obj, imageUrl) {
        var imgDiv = $(obj).parent().parent().parent();
        $("#upload-more-list").prepend(imgDiv);
        var index = imgs.indexOf(imageUrl);
        if (index > -1) {
            imgs.unshift(imgs.splice(index, 1)[0]);
        }
        $('#imageIds').val(imgs);
    }

</script>